package org.pure.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by will.lin on 2015/8/10.
 *
 * 读取pure的核心配置文件 pure.properties
 */
public class PropertiesUtil {

    private static Properties properties;

    static {
        synchronized (PropertiesUtil.class) {
            if (properties == null) {
                properties = new Properties();
                try {
                    InputStream is = PropertiesUtil.class.getResourceAsStream("/pure.properties");
                    properties.load(is);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    /**
     * get value by key
     * @param key
     * @return
     */
    public static String getProperty(String key){
        return properties.getProperty(key);
    }
}
